﻿@model PhoneBilling.Models.ExtensionBakModel
@{
    ViewBag.Title = "已删除分机";
    Layout = "~/Views/Shared/_Layout.cshtml"; 
}
<script type="text/javascript">
    $(document).ready(function () {
        $("#date1").ligerDateEditor({ showTime: true, label: '起始时间', initValue: '@Model.起始时间.ToString("yyyy-MM-dd HH:mm")', format: "yyyy-MM-dd hh:mm" });
        $("#date2").ligerDateEditor({ showTime: true, label: '终止时间', initValue: '@Model.终止时间.ToString("yyyy-MM-dd HH:mm")', format: "yyyy-MM-dd hh:mm" });

        $("#btnSearch").ligerButton(
        {
            click: function () {
                searchClick();
            }
        });
    });
</script>
@using (Html.BeginForm())
{
    <div class="extension_bak">
        <div class="system_input_contain">
            @Html.LabelFor(m => m.分机)
            @Html.TextBoxFor(m => m.分机)
        </div>
        <div class="system_input_contain">
            @Html.TextBox("起始时间", Model.起始时间, new { @id = "date1" })
            @Html.TextBox("终止时间", Model.终止时间, new { @id = "date2" })
        </div>
        <div class="system_input_contain">
            <input type="button" id="btnSearch" value="查询" />
            @*<input type="submit" value="查询" class="input-submit" onclick="searchClick()" />*@
        </div>
        
    </div>
    <div id="maingrid"></div>  
}
@{
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.AppendLine(string.Format("var data={{Total:{0},", Model.ExtensionList.Count));
    sb.AppendLine("Rows:[");
    for (int i = 0; i < Model.ExtensionList.Count; i++)
    {
        var item = Model.ExtensionList[i];
        if (i == 0)
        {
            sb.Append("{");
        }
        else
        {
            sb.Append(",{");
        }
        sb.Append(string.Format("分机号码:'{0}',", item.分机号码));
        sb.Append(string.Format("分组:'{0}',", item.分组));
        sb.Append(string.Format("用户名:'{0}',", item.用户名));
        sb.Append(string.Format("收费等级:'{0}',", item.收费等级));
        sb.Append(string.Format("费率:'{0}',", item.费率));
        sb.Append(string.Format("收费话类:'{0}'", item.收费话类));
        sb.Append("}");
    }
    sb.AppendLine("]};");
    string data = sb.ToString();
}
<script type="text/javascript">
    @Html.Raw(data)
    
    
   var grid;
    $(function () {
        
        grid = $("#maingrid").ligerGrid({
            columns: [
                { display: '分机号码', name: '分机号码',width:100},
                { display: '分组', name: '分组',width:100},
                { display: '用户名', name: '用户名',width:120},
                { display: '收费等级', name: '收费等级',width:120},
                { display: '费率', name: '费率',width:100},
                { display: '收费话类', name: '收费话类',width:120}
                ],
                isScroll: false, data: data,pageSize:30,alternatingRow:true               
        }
        );
        resetGridHeight(grid);
        $(window).resize(function () {
                resetGridHeight(grid);
            });
    });
</script>